﻿using Rainbow.core;
using System.Windows.Media;

namespace Rainbow.common
{
    public enum MessageType
    {
        Info = 0,
        Warning,
        Error
    }
    public class StatusBar
    {
        private static readonly object locker = new object();

        private static void _print(MessageType type, string str)
        {
            string contents = str;
            Color color = Colors.Blue;
            switch (type)
            {
                case MessageType.Info:
                    color = Colors.Blue;
                    break;

                case MessageType.Warning:
                    color = Colors.Orange;
                    break;

                case MessageType.Error:
                    color = Colors.Red;
                    break;

                default:
                    color = Colors.Blue;
                    break;
            }
            TW_App.statusBarInfo.contents = contents;
            TW_App.statusBarInfo.color = new SolidColorBrush(color);
        }

        public static void print(MessageType type, string format, params object[] args)
        {
            lock (locker)
            {
                string str = string.Format(format, args);
                _print(type, str);
            }
        }
    }
}
